package com.meng.message.enums;


import com.meng.message.exception.BusinessException;

/**
 * @author Mr.Still
 * @version 1.0.0
 * @date 2020-02-12 21:50
 **/
public enum ErrorEnum {

    // 基础返回码 --- begin
    SUCCESS(0, "success"),
    FAILED(-1, "服务错误"),
    PARAMS_WRONG(-2, "参数错误或缺失"),
    TOKEN_INVALID(-3, "token 无效"),
    LOGIN_TIME_OUT(-4, "登录超时"),
    USER_SERVICE_ERROR(10001, "调用用户服务接口出错"),
    USER_PASSWORD_ERROR(10002, "登录密码错误"),
    USER_EXCESSIVE_ATTEMPTS(10003, "登录失败次数过多，请5分钟后再登录!"),
    USER_LOCK_ERROR(10004, "帐号已被锁定"),
    USER_DISABLED_ERROR(10005, "帐号已被禁用"),
    USER_EXPIRED_ERROR(10006, "帐号已过期"),
    USER_ACCOUNT_UNKNOWN(10007, "帐号不存在"),
    USER_NO_PERMISSION(10008, "您没有得到相应的授权！"),
    USER_NO_CAPTCHA(10009, "验证码有误"),
    USER_TOKEN_BUILD_ERROR(10010, "token生成出错"),
    USER_TOKEN_ERROR(10011, "token错误"),
    USER_ROLE_EMPTY(10012, "没设置用户角色"),
    USER_USRE_REPEAT(10013, "用户名重复"),
    ROLE_USER_REPEAT(10014, "角色名或者角色英文名重复"),
    USER_EMPTY(10015, "用户为空"),
    NOT_EXIST_ROLE(10016,  "不存在该角色信息"),
    NAME_EXIST(10017,  "名称已经存在"),
    CANNOT_DELETE(10018,  "该菜单下存在子菜单，不能删除"),
    MENU_EXIST(10019,  "菜单名重复"),
    SELECT_PARENT_OFFICE(10020,  "请选择上级机构") ,
    OFFICE_NOT_EXIST(10021,  "上级机构不存在") ,
    MENU_NOT_EXIST(10022,  "上级菜单不存在"),
    OFFICE_CANNOT_DELETE_IN_USE(10023,  "该机构正在使用，无法删除"),
    CHILD_EXIST_CANNOT_DELETE(10024,  "该机构不可删除。只有最底层机构才可执行删除操作"),
    USER_PASSWORD_EMPTY(10025, "登录密码不能为空"),
    USER_NOT_EXIST(10026, "用户不存在"),
    USER_NOT_OFFICE(10027, "用户没有所属机构"),

    FILE_UPLOAD_FAIL(10027,"文件上传失败"),

    NOT_SELECT_OFFICE_EXIST(10028, "没有查询到相应的机构存在"),
    CODE_EXIST(10029, "编码已存在"),
    OFFICE_EXIST(10030,  "机构名称重复"),
    USER_ACCOUNT_LOCKED(10031, "用户账号锁定，等待三十分钟或者联系管理员"),
    EXCEL_RESULT_ZERO(10032,"文件上传数量为 0 ，请重新上传文件"),

    EMAIL_SEND_SUCCESS(10033,"邮件发送成功！"),
    EMAIL_SEND_FAILED(10034,"邮件发送失败"),
    USER_NOT_EMAIL(10035,"该用户没有绑定邮箱"),

    REPORT_UPDATE_ERROR(10036,"非创建用户，无法对文件进行修改"),
    TEMPLATES_DOWNLOAD_ERROR(10037,"非创建用户，无法对文件进行修改"),
    EXCEL_RESULT_SECCESS(10038,"文件上传完成"),

    NSRGROUP_NAME_USABLE(10039,"当前名称可用"),
    NSRGROUP_NAME_NO_USABLE(10040,"当前名称不可用，请重新命名"),
    NSRGROUP_NAME_NULL(10041,"分组名称不可为空"),
    REPORT_SAVE_SUCCESS(10042,"报表保存成功"),
    REPORT_SAVE_FAILED(10043,"报表保存失败"),
    USER_NOT_LONGIN(10044,"当前用户未登录，请重新登录"),
    EMAIL_NOT_VERIFY(10045,"邮箱验证失败"),
    EXCEL_FORMAT_ERROR(10046,"Excel数据格式错误."),
    SQL_GRAMMAR_ERROR(10047,"SQL语法错误"),

    //-------flow模块返回码----start----
    SAVEMSG_SERVICE_ERROR(20001, "调用消息添加接口出错"),
    MSG_NO_AUDIT(20002, "需要选择审批人员"),
    AUDIT_PARAM_ERROR(20003, "审批参数错误"),
    FLOW_END(20004, "该审批流程已经结束,无需审批"),
    AUDIT_REPEAT(20005, "您已经审批过该流程,无需重复审批"),
    AUDIT_STATUS_ERROR(20006, "审核流程STATUS状态出错"),
    NEED_ACCEPT(20007, "终审需要选择接收人"),
    CAN_NOT_AUDIT(20008, "流程流转出现异常，该节点还未能审批"),

    AUDITMSG_SERVICE_ERROR(20009, "调用流程消息审核服务接口出错"),
    NEED_FINAL_AUDIT(20010, "需要选择终审人员"),
    NO_ACCEPT_FEEDBACK(20011, "非接收人员,不能回复"),
    DUPLICATE_FEEDBACK(20012, "已有回复"),

    SAVEFEED_SERVICE_ERROR(20013, "调用流程回复添加接口出错"),
    AUDITFEED_SERVICE_ERROR(20014, "调用流程回复审核服务接口出错"),

    TRANSMIT_NEED_MSGID(20015, "转发时候需要传入消息ID"),
    TRANS_SERVICE_ERROR(20016, "调用转发接口出错"),
    MYTHINGS_SERVICE_ERROR(20017, "调用事项查询接口出错"),
    PUBLISH_SERVICE_ERROR(20018, "调用文件公告查询接口出错"),
    DETAIL_SERVICE_ERROR(20019, "调用内容详情接口出错"),
    CALENDAR_SERVICE_ERROR(20020, "调用任务日历接口出错"),
    CAROUSEL_SERVICE_ERROR(20021, "调用部门动态轮播图接口出错"),

    TRANSMIT_STATUS_ERROR(20022, "处于不可转发状态"),

    DATA_STATISTICAL_ERROR(20023,"数据统计出错"),

    DATA_MODIFICATION_ERROR(20024,"区块链安全警报：数据已被修改，请联系系统管理员！"),

    //-------flow模块返回码----end----

    //模型服务错误返回码
    MODEL_SERVICE_ERROR(50001, "调用模型服务接口出错"),

    JOB_RUN_UPDATE_FAIL(20029,"JOB修改并失败"),
    JOB_RUN_UPDATE_SECCUSS(20028,"JOB修改并成功"),
    JOB_RUN_START_SECCUSS(20027,"JOB启动成功!"),
    JOB_RUN_STOP_SECCUSS(20026,"JOB停止成功!"),
    JOB_SAVE_RUN_FAIL(20025,"JOB添加失败");


    // 错误码
    private int errorCode;

    // 错误信息
    private String message;

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    ErrorEnum(int errorCode, String message) {
        this.errorCode = errorCode;
        this.message = message;
    }

    ErrorEnum(BusinessException e) {
        this.errorCode = e.getErrorCode();
        this.message = e.getMessage();
    }
}
